var renderCompanyPage = {
    init: function () {
        this.bindEvent();
    },
    bindEvent: function() {
        this.getUserData( { id: getArgs().checkId } );
    },
    getUserData: function(param) {
        var _this = this;
        var methodId = "4025";
        var info = postdata(methodId,param);
        $.ajax({
            url: global.uip.url,
            type: "post",
            data: info,
            success: function (jsonData) {
                console.log( "4025",jsonData );
                if (jsonData.code == "0") {
                    var data = jsonData.res.data;
                    _this.renderPage( data );
                } else {
                    $('.all-info .weui_dialog_bd.prompt_text').html( jsonData.res.msg );
                    $('.all-info .weui_dialog_alert').show();
                }
            },
            error: function () {
                alert("接口错误");
            }
        });
    },
    renderPage: function( data ) {
        var _this = this;
        //render Page1
        $('.base-info input[name=landlordName]').val( data.landlordName );
        $('.base-info input[name=idcard-num]').val( data.idCardNo );
        $('.base-info input[name=back-name]').val( data.bankName );
        $('.base-info input[name=back-account]').val( data.bankAccount );
        $('.base-info input[name=landlord-phone]').val( data.phone );

        //render Page2
        $(".upload-idcard .id-card-01 .pic-area .fileView.preview img").attr( 'src',data.idCard );
        $(".upload-idcard .id-card-01 .pic-area").addClass('success');
        $(".upload-idcard .id-card-01 .uploadFileAddress").val( data.idCard );
        $('.upload-idcard input[name="landlord.positiveIdCard"]').val( data.idCard );

        $(".upload-idcard .id-card-02 .pic-area .fileView.preview img").attr( 'src',data.idCardBack );
        $(".upload-idcard .id-card-02 .pic-area").addClass('success');
        $(".upload-idcard .id-card-02 .uploadFileAddress").val( data.idCardBack );
        $('.upload-idcard input[name="landlord.backIdCard"]').val( data.idCardBack );

        //多张图片
        _this.renderMorePics( ".upload-idcard","rentalPics",data.rental );
        _this.uploadIdcardNext();

        //render Page3
        data.clientCard = data.clientCard || '';
        $('.consignor-info input[name=companyName]').val( data.company );
        $('.consignor-info input[name=companyAddress]').val( data.companyAddress );

        _this.renderMorePics( ".consignor-info","certificatePics",data.certificate,true );
        _this.renderMorePics( ".consignor-info","codeCertificatePics",data.codeCertificate,true );
        _this.renderMorePics( ".consignor-info","provePics",data.prove,true );
        _this.consignorInfoNext();


        //render Page4
    },
    renderMorePics: function( selector,className,json,flag ) {
        var _this = this;
        flag = flag || false;
        console.log( flag );
        var outDom;
        if( json.length == '0' ) {
            var innerDom = '<div class="upload modal1">'
                            +  '<input type="hidden" class="uploadFileAddress" value="">'
                            +  '<div class="pic-area success">'
                            +    '<div class="fileView preview">'
                            +      '<img src="" alt="" />'
                            +    '</div>'
                            +    '<div class="origin preview">'
                            +      '<img src="" alt="" />'
                            +    '</div>'
                            +    '<div class="tip preview">'
                            +      '<img class="jiahao" src="../../../public/img/Oval 7.png" alt="">'
                            +    '</div>'
                            +    '<input type="file" accept="image/*" name="uploadFile">'
                            +  '</div>'
                            +  '<div class="remove"></div>'
                            +'</div>';
                outDom = '<div class="'+ className +' id-card-03" style="background: #fff;">'+ innerDom +'</div><input type="hidden" value="" name="'+ className +'_03">';
                //debugger;
                if( flag ) {
                    $(selector+' .main .mod-upload-pic .item .'+className+'-wrapper').html( outDom );
                } else {
                    $(selector+' .main .mod-upload-pic .item').append( outDom );
                }
                _this.uploadMorePicsInit( selector,className,'3' );
        } else {
            $.each( json,function(i,val) {
                val = isClouddn( val );
                var innerDom = '<div class="upload modal1">'
                            +  '<input type="hidden" class="uploadFileAddress" value="'+ val +'">'
                            +  '<div class="pic-area success">'
                            +    '<div class="fileView preview">'
                            +      '<img src="'+ val +'" alt="" />'
                            +    '</div>'
                            +    '<div class="origin preview">'
                            +      '<img src="" alt="" />'
                            +    '</div>'
                            +    '<div class="tip preview">'
                            +      '<img class="jiahao" src="../../../public/img/Oval 7.png" alt="">'
                            +    '</div>'
                            +    '<input type="file" accept="image/*" name="uploadFile">'
                            +  '</div>'
                            +  '<div class="remove"></div>'
                            +'</div>';
                outDom = '<div class="'+ className +' id-card-0'+ (i+3) +'" style="background: #fff;">'+ innerDom +'</div><input type="hidden" value="'+ val +'" name="'+ className +'_0'+ (i+3) +'">';
                //debugger;
                if( flag ) {
                    $(selector+' .main .mod-upload-pic .item .'+className+'-wrapper').html( outDom );
                } else {
                    $(selector+' .main .mod-upload-pic .item').append( outDom );
                }
                _this.uploadMorePicsInit( selector,className,(i+3) );

                $(selector+" .id-card-0"+ (i+3) +" .pic-area .fileView.preview img").attr( 'src',val );
                $(selector+" .id-card-0"+ (i+3) +" .pic-area").addClass('success');
                $(selector+" .id-card-0"+ (i+3) +" .uploadFileAddress").val( val.substring(22) );
                $(selector+' input[name="'+ className +'_0'+ (i+3) +'"]').val( val.substring(22) );
            } );
        }

    },
    uploadIdcardNext: function() {
        $('.upload-idcard .next-step').on('click',function() {
            var landlordPositiveIdCard = $('.upload-idcard input[name="landlord.positiveIdCard"]').val();
            var landlordBackIdCard = $('.upload-idcard input[name="landlord.backIdCard"]').val();

            var rentalNum = $('.rentalPics').length;
            var rentalArr = [];
            for( var i=0; i<rentalNum; i++ ) {
                var index = i+3;
                var imgStr = isClouddn( $('input[name="rentalPics_0'+ index +'"]').val() );
                rentalArr.push( imgStr );
            }
            console.log( rentalArr );


            // if( !landlordPositiveIdCard ) {
            //     $(this).parents('.upload-idcard').find('.weui_dialog_bd.prompt_text').html('请上传身份证正面照');
            //     $(this).parents('.upload-idcard').find('.weui_dialog_alert').show();
            //     return false;
            // }
            // if( !landlordBackIdCard ) {
            //     $(this).parents('.upload-idcard').find('.weui_dialog_bd.prompt_text').html('请上传身份证反面照');
            //     $(this).parents('.upload-idcard').find('.weui_dialog_alert').show();
            //     return false;
            // }
            // if( !rentalArr ) {
            //     $(this).parents('.upload-idcard').find('.weui_dialog_bd.prompt_text').html('请上传相关半年收租流水或者提供财报');
            //     $(this).parents('.upload-idcard').find('.weui_dialog_alert').show();
            //     return false;
            // }

            postParams.idCard = isClouddn( landlordPositiveIdCard );
            postParams.idCardBack = isClouddn( landlordBackIdCard );
            postParams.rental = rentalArr;
            console.log( postParams );
            $(this).parents('.upload-idcard').hide();
            $('.consignor-info').show();
        });
    },
    consignorInfoNext: function() {
        $('.consignor-info .next-step').on('click',function() {
            //
            var companyName = $('.consignor-info input[name=companyName]').val();
            var companyAddress = $('.consignor-info input[name=companyAddress]').val();

            var certificateNum = $('.certificatePics').length;
            console.log( certificateNum );
            var certificateArr = [];
            for( var i=0; i<certificateNum; i++ ) {
                var index = i+3;
                var imgStr = isClouddn( $('input[name="certificatePics_0'+ index +'"]').val() );
                certificateArr.push( imgStr );
            }
            console.log( certificateArr );

            var codeCertificateNum = $('.codeCertificatePics').length;
            console.log( codeCertificateNum );
            var codeCertificateArr = [];
            for( var i=0; i<codeCertificateNum; i++ ) {
                var index = i+3;
                var imgStr = isClouddn( $('input[name="codeCertificatePics_0'+ index +'"]').val() );
                codeCertificateArr.push( imgStr );
            }
            console.log( codeCertificateArr );

            var proveNum = $('.certificatePics').length;
            console.log( proveNum );
            var proveArr = [];
            for( var i=0; i<proveNum; i++ ) {
                var index = i+3;
                var imgStr = isClouddn( $('input[name="certificatePics_0'+ index +'"]').val() );
                proveArr.push( imgStr );
            }
            console.log( proveArr );

            // if( !consignorMobile ) {
            //     $(this).parents('.consignor-info').find('.weui_dialog_bd.prompt_text').html('请上传委托人手机号');
            //     $(this).parents('.consignor-info').find('.weui_dialog_alert').show();
            //     return false;
            // }
            // if( !consignorPositiveIdCard ) {
            //     $(this).parents('.consignor-info').find('.weui_dialog_bd.prompt_text').html('请上传委托人身份证正面照');
            //     $(this).parents('.consignor-info').find('.weui_dialog_alert').show();
            //     return false;
            // }
            // if( !consignorBackIdCard ) {
            //     $(this).parents('.consignor-info').find('.weui_dialog_bd.prompt_text').html('请上传委托人身份证反面照');
            //     $(this).parents('.consignor-info').find('.weui_dialog_alert').show();
            //     return false;
            // }
            // if( !imgArr ) {
            //     $(this).parents('.consignor-info').find('.weui_dialog_bd.prompt_text').html('请上传委托人授权书');
            //     $(this).parents('.consignor-info').find('.weui_dialog_alert').show();
            //     return false;
            // }

            postParams.company = companyName;
            postParams.companyAddress = companyAddress;
            postParams.certificate = certificateArr;
            postParams.codeCertificate = codeCertificateArr;
            postParams.prove = proveArr;

            console.log( postParams );

             $(this).parents('.consignor-info').hide();
             $('.all-info').show();

            renderAllInfo();
        });
    },
    uploadMorePicsInit: function (selector,className,index) {
        var takeIdCard;
        $(selector+" .id-card-0"+index).uploadImage({
            url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
            idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
            defaultImage: "../../../public/img/handleCard@2x.png",
            preAddress: global.uip.preAddress,//imageAddress,
            fileImage: takeIdCard,
            onchange: function($el) {
                var list = $( selector+" .id-card-0"+ index +" .uploadFileAddress")[0], string;
                if (list) {
                    string = list.value;
                }
                $(selector+" input[name='"+ className +"_0"+ index +"']").val(string);
            }
        });
    }
};
renderCompanyPage.init();


    var postParams = {};
    postParams.landlordId = getArgs().landlordId;
    postParams.checkId  = getArgs().checkId;

    //点击弹框的 确定 按钮，弹框消失
    $('.weui_btn_dialog.primary').on('click',function() {
        $(this).parents('.weui_dialog_alert').hide();
    });

    //点击基本信息页面 下一步
    var myreg = /^1\d{10}$/;
    var reg = /(^\d{17}$)(\d|X|x)$)/; 
    $('.base-info .next-step').on('click',function() {
        if( $('.base-info input[name=landlordName]').val() == '' ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('法人姓名必填');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( $('.base-info input[name=idcard-num]').val() == '' ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('法人身份证号必填');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( $('.base-info input[name=idcard-num]').val().length !=18 ){
            $('.weui_dialog_bd.prompt_text').html('请输入正确身份证号');
            $('.weui_dialog_alert').show();
            return false;
        } 
        if( !reg.test( $('.base-info input[name=idcard-num]').val() ) ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('请输入正确身份证号');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( $('.base-info input[name=back-name]').val() == '' ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('房东收款银行必填');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( $('.base-info input[name=back-account]').val() == '' ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('房东收款银行卡号必填');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( $('.base-info input[name=landlord-phone]').val() == '' ) {
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('业务负责人手机号必填');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        if( !myreg.test( $('.base-info input[name=landlord-phone]').val() ) ){
            $(this).parents('.base-info').find('.weui_dialog_bd.prompt_text').html('请输入正确手机号');
            $(this).parents('.base-info').find('.weui_dialog_alert').show();
            return false;
        }
        //获取用户填写的信息
        postParams.landlordName = $('.base-info input[name=landlordName]').val();
        postParams.idCardNo = $('.base-info input[name=idcard-num]').val();
        postParams.bankName = $('.base-info input[name=back-name]').val();
        postParams.bankAccount = $('.base-info input[name=back-account]').val();
        postParams.phone = $('.base-info input[name=landlord-phone]').val();

        console.log( postParams );
        $(this).parents('.base-info').hide();
        $('.upload-idcard').show();
    });

    //page2
    var positiveIdCard ;
    $(".upload-idcard .id-card-01").uploadImage({
        url: global.uip.photoUrl,// globalUploadHost + uploadUrl,
        idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
        preAddress:global.uip.preAddress,// imageAddress,
        defaultImage: "../../../public/img/shenzhengmian@2x.png",
        fileImage: positiveIdCard,
        /*是否启动自增自减*/
        autoAppend: false,
        /*如果启动了自增减，那么这个参数必须传*/
        autoMax: 3,
        onchange: function($el) {
            var list = $(".upload-idcard .id-card-01 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".upload-idcard input[name='landlord.positiveIdCard']").val(string);
        }
    });

    var backIdCard ;
    $(".upload-idcard .id-card-02").uploadImage({
        url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
        idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,

        defaultImage: "../../../public/img/shenfenzheng@2x.png",
        preAddress: global.uip.preAddress,//imageAddress,
        fileImage: backIdCard,
        onchange: function($el) {
            var list = $(".upload-idcard .id-card-02 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".upload-idcard input[name='landlord.backIdCard']").val(string);
        }
    });

    var takeIdCard;
    $(".upload-idcard .id-card-03").uploadImage({
        url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
        idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
        defaultImage: "../../../public/img/handleCard@2x.png",
        preAddress: global.uip.preAddress,//imageAddress,
        fileImage: takeIdCard,
        onchange: function($el) {
            var list = $(".upload-idcard .id-card-03 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".upload-idcard input[name='personal_03']").val(string);

            personalLandlordAddPic();
        }
    });

    var picIndex = 3;
    function personalLandlordAddPic() {

        picIndex++;
        var dom = '<div class="personalLandlord id-card-0'+ picIndex +'" style="background: #fff;"></div><input type="hidden" name="personal_0'+ picIndex +'">';
        $('.upload-idcard .main .mod-upload-pic .item').append( dom );

        $( ".upload-idcard .id-card-0"+picIndex ).uploadImage({
            url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
            idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
            defaultImage: "../../../public/img/handleCard@2x.png",
            preAddress: global.uip.preAddress,//imageAddress,
            fileImage: takeIdCard,
            onchange: function($el) {
                var list = $(".upload-idcard .id-card-0"+ picIndex +" .uploadFileAddress")[0], string;
                if (list) {
                    string = list.value;
                }
                $(".upload-idcard input[name='personal_0"+ picIndex +"']").val(string);
                personalLandlordAddPic();
            }
        });
    }


    //page3
    var positiveIdCard ;
    $(".consignor-info .id-card-01").uploadImage({
        url: global.uip.photoUrl,// globalUploadHost + uploadUrl,
        idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
        preAddress:global.uip.preAddress,// imageAddress,
        defaultImage: "../../../public/img/shenzhengmian@2x.png",
        fileImage: positiveIdCard,
        /*是否启动自增自减*/
        autoAppend: false,
        /*如果启动了自增减，那么这个参数必须传*/
        autoMax: 3,
        onchange: function($el) {
            var list = $(".consignor-info .id-card-01 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".consignor-info input[name='consignor.positiveIdCard']").val(string);
        }
    });

    var backIdCard ;
    $(".consignor-info .id-card-02").uploadImage({
        url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
        idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,

        defaultImage: "../../../public/img/shenfenzheng@2x.png",
        preAddress: global.uip.preAddress,//imageAddress,
        fileImage: backIdCard,
        onchange: function($el) {
            var list = $(".consignor-info .id-card-02 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".consignor-info input[name='consignor.backIdCard']").val(string);
        }
    });

    var takeIdCard;
    var picIndexConsignor = 3;
    $(".consignor-info .id-card-03").uploadImage({
        url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
        idCard: "8a28cd6e5per86797fc015867a6a2eb001d",//landlordUserInfo.id,
        defaultImage: "../../../public/img/handleCard@2x.png",
        preAddress: global.uip.preAddress,//imageAddress,
        fileImage: takeIdCard,
        onchange: function($el) {
            var list = $(".consignor-info .id-card-03 .uploadFileAddress")[0], string;
            if (list) {
                string = list.value;
            }
            $(".consignor-info input[name='prover_03']").val(string);
            consignorAddPic();
        }
    });

    function consignorAddPic() {
        picIndexConsignor++;
        var dom = '<div class="prover id-card-0'+ picIndexConsignor +'" style="background: #fff;"></div><input type="hidden" name="prover_0'+ picIndexConsignor +'">';
        $('.consignor-info .main .mod-upload-pic .item').append( dom );
        $( ".consignor-info .id-card-0"+picIndexConsignor ).uploadImage({
            url: global.uip.photoUrl,//globalUploadHost + uploadUrl,
            idCard: "8a28cd6e586797fc015867a6a2eb001d",//landlordUserInfo.id,
            defaultImage: "../../../public/img/handleCard@2x.png",
            preAddress: global.uip.preAddress,//imageAddress,
            fileImage: takeIdCard,
            onchange: function($el) {
                var list = $(".consignor-info .id-card-0"+ picIndexConsignor +" .uploadFileAddress")[0], string;
                if (list) {
                    string = list.value;
                }
                $(".consignor-info input[name='prover_0"+ picIndexConsignor +"']").val(string);
                consignorAddPic();
            }
        });
    }

    function renderAllInfo() {
        // baseInfo
        $('.all-info span[name="landlord-name"]').html( $('.base-info input[name=landlordName]').val() );
        $('.all-info span[name="landlord-idcard"]').html( $('.base-info input[name=idcard-num]').val() );
        $('.all-info span[name="landlord-backName"]').html( $('.base-info input[name=back-name]').val() );
        $('.all-info span[name="landlord-backAccount"]').html( $('.base-info input[name=back-account]').val() );
        $('.all-info span[name="landlord-phoneNum"]').html( $('.base-info input[name=landlord-phone]').val() );
        // upload-idcard
        $('.all-info img[name="consignor-positive-card"]').attr( 'src',isClouddn( $(".upload-idcard input[name='landlord.positiveIdCard']").val() ) );
        $('.all-info img[name="consignor-back-card"]').attr( 'src',isClouddn( $(".upload-idcard input[name='landlord.backIdCard']").val() ) );

        var rentalNum = $('.rentalPics').length;
        console.log(rentalNum);
        var dom = '';
        var index=0;
        for( var i=0; i<rentalNum; i++ ) {
            index = i+3;
            dom += '<li>'
                    +   '<img src="'+isClouddn( $('input[name="rentalPics_0'+ index +'"]').val() )+'"/>'
                    +   '<span class="hidden"><img src="'+isClouddn( $('input[name="rentalPics_0'+ index +'"]').val() )+'"/>'
                    +   '</span>'
                    + '</li>';
        }
        $('.all-info .kePublic.landlord-wrapper .msKeimgBox ul').append(dom);

        //企业信息
        $('.all-info span[name="companyName"]').html( $('.consignor-info input[name=companyName]').val() );
        $('.all-info span[name="companyAddress"]').html( $('.consignor-info input[name=companyAddress]').val() );

        var certificateNum = $('.certificatePics').length;
        var codeCertificateNum = $('.codeCertificatePics').length;
        var proverNum = $('.proverPics').length;
        console.log( certificateNum,codeCertificateNum,proverNum );
        var certificateIndex = 0,codeCertificateIndex = 0,proverIndex = 0;
        var dom2 = '';
        for( var i=0; i<certificateNum; i++ ) {
            certificateIndex = i+3;
            dom2 += '<li>'
                     +   '<img src="'+isClouddn( $('input[name="certificatePics_0'+ certificateIndex +'"]').val() )+'"/>'
                     +   '<span class="hidden"><img src="'+isClouddn( $('input[name="certificatePics_0'+ certificateIndex +'"]').val() )+'"/>'
                     +   '</span>'
                     +'</li>';
                     console.log( isClouddn( $('input[name="certificatePics_0'+ certificateIndex +'"]').val() ) );
        }
        for( var i=0; i<codeCertificateNum; i++ ) {
            codeCertificateIndex = i+3;
            dom2 += '<li>'
                     +   '<img src="'+isClouddn( $('input[name="codeCertificatePics_0'+ codeCertificateIndex +'"]').val() )+'"/>'
                     +   '<span class="hidden"><img src="'+isClouddn( $('input[name="codeCertificatePics_0'+ codeCertificateIndex +'"]').val() )+'"/>'
                     +   '</span>'
                     +'</li>';
                    console.log( isClouddn( $('input[name="codeCertificatePics_0'+ codeCertificateIndex +'"]').val() ) );
        }
        for( var i=0; i<proverNum; i++ ) {
            proverIndex = i+3;
            dom2 += '<li>'
                     +   '<img src="'+isClouddn( $('input[name="prover_0'+ proverIndex +'"]').val() )+'"/>'
                     +   '<span class="hidden"><img src="'+isClouddn( $('input[name="prover_0'+ proverIndex +'"]').val() )+'"/>'
                     +   '</span>'
                     +'</li>';
                    console.log( isClouddn( $('input[name="prover_0'+ proverIndex +'"]').val() ) );
        }
        $('.all-info .kePublic.consignor-wrapper .msKeimgBox ul').append(dom2);

    }

    //page4 点击汇总展示页面 下一步
    $('.all-info .next-step').on('click',function() {
        var flag = $('#aleady-read').is(':checked');
        console.log( flag );
        if( !flag == 'false' ) {
            $(this).parents('.consignor-info').find('.weui_dialog_bd.prompt_text').html('请同意房租月付条款');
            $(this).parents('.consignor-info').find('.weui_dialog_alert').show();
            return false;
        }
        postContract(postParams);
    });

    //封装ajax
    function postContract(param) {
        var methodId = "4026";

        var info = postdata(methodId,param);

        $.ajax({
                url: global.uip.url,
                type: "post",
                data: info,
                success: function (jsonData) {
                    if (jsonData.code == "0") {
                        window.location.href = 'checking.html';
                    } else if ( jsonData.code == "410" ) {
                        $('.all-info .weui_dialog_bd.prompt_text').html( jsonData.res.msg );
                        $('.all-info .weui_dialog_alert').show();
                    }
                }
            });
    }

    //historyBack
    $('.upload-idcard.ghy').on('click','.back-button',function(){
        $(this).parents('.upload-idcard.ghy').hide();
        $('.base-info').show();
    });
    $('.consignor-info').on('click','.back-button',function(){
        $(this).parents('.consignor-info').hide();
        $('.upload-idcard.ghy').show();
    });
    $('.all-info').on('click','.back-button',function(){
        $(this).parents('.all-info').hide();
        $('.consignor-info').show();
    });

    //点击查询授权书
    $('.check-cluase').on('click', function () {
        location.href = "contractDetail.html";
    });

    //判断图片地址是否包含http
    function isClouddn( str ) {
        if( str.indexOf('clouddn') >= 0 ) {
            return str;
        } else if( str.indexOf('http') >= 0 ) {
            return str;
        } else {
            return global.uip.preAddress+str;
        }
    }




